package controller

import (
	"context"
	"xr-game-server/core/httpserver"
	"xr-game-server/dto/itemdto"
	"xr-game-server/module/item"
)

const (
	ItemUrl = "/item"
)

type Item struct {
}

func initItem() {
	httpserver.RegCMS(ItemUrl, new(Item))
}

func (this *Item) AddItem(context context.Context, req *itemdto.AddItemReq) (res bool, er error) {
	item.AddItem(context, req)
	return true, nil
}

func (this *Item) ConsumeItem(ctx context.Context, req *itemdto.ConsumeItemReq) (res bool, er error) {
	return item.Consume(httpserver.GetAuthId(ctx), req.Data, true), nil
}
